#include <stdio.h>
#include <algorithm>
using namespace std;

int v[6];
int temp[3];
int res;

int main() {
	for (int i=0; i<4; i++)
		scanf("%d", &v[i]);

	res=-1;

	for (int i=0; i<4; i++) {
		for (int j=i+1; j<4; j++) {
			for (int k=j+1; k<4; k++) {
				temp[0] = v[i];
				temp[1] = v[j];
				temp[2] = v[k];

				sort(temp, temp+3);
	
				if (temp[0]+temp[1]==temp[2] && res!=1)
					res = 0;

				else if (temp[0]+temp[1]>temp[2]) res=1;
			}
		}
	}

	switch (res) {
		case -1:
			printf("IMPOSSIBLE\n");
			break;
		case 0:
			printf("SEGMENT\n");
			break;
		case 1:
			printf("TRIANGLE\n");
			break;
	}

	return 0;
}
